home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / pctecap.arc / FNKEYS.PAS < prev    next >
Pascal/Delphi Source File  |  1986-03-15  |  2KB  |  89 lines

  1. { Program to Set Up Function Keys Using
  2.     ANSI.SYS Keyboard Driver Under DOS 2.0
  3.   Version 840110.1 Pascal IBM PC
  4.   Latest  840111
  5.   Arthur A. Gleckler
  6.  
  7.     Before this program is used, the ANSI.SYS
  8.   keyboard device driver should be installed.
  9.   This is done by placing the line
  10.  
  11.     device=ansi.sys
  12.  
  13.   in a file called CONFIG.SYS on the disk
  14.   which the computer is booted from.  A copy
  15.   of the ANSI.SYS program should also be
  16.   present on the boot disk.
  17. }
  18.  
  19. PROGRAM FnKeys;
  20.  
  21. TYPE
  22.   DefString = STRING [20];
  23.  
  24.   PROCEDURE ID;
  25.   { Identify program to user }
  26.   BEGIN
  27.     WRITE (CHR (27), '[2J');
  28.          { Clear the screen and home cursor }
  29.     WRITE ('Program to Set Up Function Keys');
  30.     WRITE (' Using ANSI.SYS Keyboard Driver');
  31.     WRITELN (' Under DOS 2.0');
  32.     WRITELN;
  33.     WRITE ('  The ANSI.SYS keyboard driver');
  34.     WRITE (' must be installed before this');
  35.     WRITELN (' program is run.');
  36.     WRITELN
  37.   END;
  38.  
  39.   PROCEDURE DefineKey (FunctionKey:INTEGER;
  40.                       NewString:DefString);
  41.   { Sends codes to ANSI.SYS keyboard driver
  42.     to redefine a function key; function keys
  43.     have extended ASCII codes, with a 0
  44.     followed by a number 59-68 for function
  45.     keys 1-10, respectively
  46.   }
  47.   BEGIN
  48.     WRITE (CHR (27), '[0;');
  49.     WRITE ((FunctionKey + 58):2, ';"');
  50.     WRITE (NewString, '";13p')
  51.   END;
  52.  
  53.   PROCEDURE SetupKeys;
  54.   { Ask user which key to redefine and what
  55.     new definition is
  56.   }
  57.   VAR Number     : INTEGER;
  58.       Definition : STRING [20];
  59.   BEGIN
  60.     REPEAT
  61.       WRITE ('Please enter the number');
  62.       WRITE (' (1 - 10) of a function');
  63.       WRITELN (' key to redefine');
  64.       WRITE ('  or enter 0 if all key');
  65.       WRITELN (' redefinition is complete.');
  66.       WRITE ('Function Key Number: ');
  67.       READLN (Number);
  68.       IF Number IN [1..10]
  69.         THEN
  70.           BEGIN
  71.             WRITE ('Enter definition');
  72.             WRITELN (' for F', Number:1, '.');
  73.             WRITE ('Definition String: ');
  74.             READLN (Definition);
  75.             DefineKey (Number, Definition);
  76.             WRITE ('F', Number:1, ' = ');
  77.             WRITELN (Definition);
  78.             WRITELN
  79.           END
  80.     UNTIL NOT (Number IN [1..10]);
  81.     WRITELN;
  82.     WRITELN ('Function key setup ended.')
  83.   END;
  84.  
  85. BEGIN
  86.   ID;
  87.   SetupKeys
  88. END.
  89.